#ifndef __object__
#define __object__
class environment;

class object: public boost::enable_shared_from_this<object> {
    std::string name;
    bool ischg;

public:
    object(std::string s, bool is = true): name(s), ischg(is) { }
    virtual ~object() { }
    bool ischange() { return ischg; }
    virtual std::string to_string() { return name.c_str(); }
    void set_name(std::string str) { name = str; }
    void print(boost::shared_ptr<environment>);
    virtual std::string get_type() = 0;
    virtual boost::shared_ptr<object> eval(boost::shared_ptr<environment> env) { return shared_from_this(); }
    virtual std::string read() { throw Error(new error(error::notport)); }
    virtual void write(std::string) { throw Error(new error(error::notport)); }
    virtual void set_arg(boost::shared_ptr<object>) { throw Error(new error(error::notfunc)); }
    virtual void set_car(boost::shared_ptr<object>) { throw Error(new error(error::notlist)); }
    virtual void set_cdr(boost::shared_ptr<object>) { throw Error(new error(error::notlist)); }
    virtual boost::shared_ptr<object> get_car() { throw Error(new error(error::notlist)); }
    virtual boost::shared_ptr<object> get_cdr() { throw Error(new error(error::notlist)); }
    virtual double get_num() { throw Error(new error(error::notnum)); }
    virtual void set_num(double) { throw Error(new error(error::notnum)); }
    virtual void operator +=(boost::shared_ptr<object>) { throw Error(new error(error::opera)); }
    virtual void operator -=(boost::shared_ptr<object>) { throw Error(new error(error::opera)); }
    virtual void operator *=(boost::shared_ptr<object>) { throw Error(new error(error::opera)); }
    virtual void operator /=(boost::shared_ptr<object>) { throw Error(new error(error::opera)); }
    virtual void operator %=(boost::shared_ptr<object>) { throw Error(new error(error::opera)); }
    virtual bool operator ==(boost::shared_ptr<object>) { throw Error(new error(error::opera)); }
    virtual bool operator !=(boost::shared_ptr<object>) { throw Error(new error(error::opera)); }
    virtual bool operator <(boost::shared_ptr<object>) { throw Error(new error(error::opera)); }
    virtual bool operator >(boost::shared_ptr<object>) { throw Error(new error(error::opera)); }
    virtual bool operator <=(boost::shared_ptr<object>) { throw Error(new error(error::opera)); }
    virtual bool operator >=(boost::shared_ptr<object>) { throw Error(new error(error::opera)); }
};
typedef boost::shared_ptr<object> Object;
#endif
